-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(auto-edits): adding autoedits onboarding setup for dotcom users #6463
Conversation
742874b
to
ab9ec69
Compare
b08f12a
to
81b0302
Compare
2018bc0
to
0f22a0e
Compare
ab63f60
to
0fb8d6d
Compare
!isUserEligibleForAutoeditsFeature( | ||
autoeditsFeatureFlagEnabled, | ||
authStatus, | ||
userProductSubscription | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this check one level higher to the registerAutoEdits
function in main.ts
. If a user is not eligible, we should not attempt to call the createAutoEditsProvider
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any specific reason why main.ts
could be better here ?
I liked it here since that puts all the logic for creating/decide if not to create provider in a single place. Also, if the logic becomes more complex (such as the proposal to show pop-up to the non eligible users ) we want to add condition under the if, so we can do this in the same file.
Do you think it would be okay to just keep it here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed we still have a check for the feature flag at the top level, but now I see that we moved all conditions into one place. That was the primary purpose of this suggestion 👍
) | ||
) { | ||
throw new Error( | ||
'User is not eligible for auto-edits. Can not initialize auto-edits provider.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful for debugging if we named the reason here or at least logged it to the output channel. That way, when users come to us with questions about this error, we can triage it faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the message which we will show to the user as per the discussion. A quick snapshot below, when free user tried to access auto-edits
:
private async getAutoEditsOnboardingNotificationCount(): Promise<number> { | ||
return await localStorage.getAutoEditsOnboardingNotificationCount() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need to await
in cases where we only need to return a promise
private async getAutoEditsOnboardingNotificationCount(): Promise<number> { | |
return await localStorage.getAutoEditsOnboardingNotificationCount() | |
} | |
private getAutoEditsOnboardingNotificationCount(): Promise<number> { | |
return localStorage.getAutoEditsOnboardingNotificationCount() | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
private async isUserEligibleForAutoeditsOnboarding(): Promise<boolean> { | ||
const authStatus = currentAuthStatus() | ||
const productSubsubscription = await currentUserProductSubscription() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const productSubsubscription = await currentUserProductSubscription() | |
const productSubscription = await currentUserProductSubscription() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
export function isUserEligibleForAutoeditsFeature( | ||
autoeditsFeatureFlagEnabled: boolean, | ||
authStatus: AuthStatus, | ||
productSubsubscription: UserProductSubscription | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
productSubsubscription: UserProductSubscription | null | |
productSubscription: UserProductSubscription | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
private async isAutoeditsNotificationsUnderLimit(): Promise<boolean> { | ||
const count = await this.getAutoEditsOnboardingNotificationCount() | ||
return count < this.MAX_AUTO_EDITS_ONBOARDING_NOTIFICATIONS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we decide to show it multiple times, we should add a progressive timeout between prompts to avoid coming across as spammy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the min 1 hour timeout between 2 calls
const selection = await vscode.window.showInformationMessage( | ||
'✨ Try Cody auto-edits: Experimental feature which suggests advanced context-aware code edits as you navigate the codebase', | ||
'Enable auto-edits' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a "Don't Show Again" option here? (like
public static readonly noThanksText = 'Don’t Show Again' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the text
vscode.ConfigurationTarget.Global | ||
) | ||
|
||
// Open VS Code settings UI and focus on the Cody Autoedits setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the thinking behind opening the settings panel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to make them aware where to find the settings in case they want to turn on/off or switch between autocomplete/auto-edits.
private async showAutoeditsOnboardingPopup(): Promise<void> { | ||
const selection = await vscode.window.showInformationMessage( | ||
'✨ Try Cody auto-edits: Experimental feature which suggests advanced context-aware code edits as you navigate the codebase', | ||
'Enable auto-edits' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Enable auto-edits' | |
'Enable Auto-Edits' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
private async showAutoeditsOnboardingPopup(): Promise<void> { | ||
const selection = await vscode.window.showInformationMessage( | ||
'✨ Try Cody auto-edits: Experimental feature which suggests advanced context-aware code edits as you navigate the codebase', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'✨ Try Cody auto-edits: Experimental feature which suggests advanced context-aware code edits as you navigate the codebase', | |
'Try Cody Auto-Edits (experimental)? Cody will intelligently suggest next edits as you navigate the codebase.', |
I don't love "as you navigate the codebase" though — does this trigger when you just open files, or when you're actively working on a file, or…?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I just realised this feature replaces the standard autocomplete behaviour too, which people probably have a very strong familiarity with. Is it easy to toggle this feature on/off via the Cody statusbar menu in the bottom right corner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"as you navigate the codebase" seems to reflect that user doesn't have to type anything to get suggestions, they can get suggestion even if they move the cursor in the file.
Yes, they can get suggestion even if you just open the file. One example is - if user have made modification in some other files, model might suggest the change in the current file based on where your cursor is currently placed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it easy to toggle this feature on/off via the Cody statusbar menu in the bottom right corner?
Not yet, I think it is still experimental and when users click "enable auto-edits" we take them to the settings so that they know where to switch between auto-edits
and autocomplete
.
57d3094
to
ba9805e
Compare
|
||
export class AutoeditsOnboarding implements vscode.Disposable { | ||
private readonly MAX_AUTO_EDITS_ONBOARDING_NOTIFICATIONS = 3 | ||
private readonly MIN_TIME_DIFF_AUTO_EDITS_BETWEEN_NOTIFICATIONS_MS = 60 * 60 * 1000 // 1 hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TY!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Going to include this in the next pre-release!
auto-edits
feature.auto-edits
feature based on the conditions:auto-edits
, we show a pop up to the user (max 3 times). Clicking on the pop-up enables auto-edits for the user.@aramaraju Does the conditions above looks okay to you ?
auto-edits.onboarding.mp4
Test plan
CI